<?php
require_once ("../db/connectdatabase.php");

function insertObjectBankLoan($id, $idproduct, $idbank, $dactinh, $dieukien, $thutuc) {
	$con = new ConnectDB();
	$tbl = "loan_for_intro_product";
	$fn = array('keyipro' => $id, 'prkey' => $idproduct, 'bankid' => $idbank, 'dac_tinh_loan' => $dactinh, 'object_dk_loan' => $dieukien, 'thu_tuc_loan' => $thutuc, 'datecreate' => $id);
	return $con -> insert($tbl, $fn);
}

function updateObjectBankLoan($id, $idproduct, $idbank, $dactinh, $dieukien, $thutuc) {
	$con = new ConnectDB();
	$tbl = "loan_for_intro_product";
	$fn = array('prkey' => $idproduct, 'bankid' => $idbank, 'dac_tinh_loan' => $dactinh, 'object_dk_loan' => $dieukien, 'thu_tuc_loan' => $thutuc, 'datecreate' => time());
	$condition = array('keyipro' => $id);
	return $con -> update($tbl, $fn, $condition);
}

function updateDisplayObjectBankLoan($id, $use) {
	$con = new ConnectDB();
	$tbl = "loan_for_intro_product";
	$fn = array('isavalible' => $use, 'datecreate' => time());
	$condition = array('keyipro' => $id);
	return $con -> update($tbl, $fn, $condition);
}

function deleteDisplayObjectBankLoan($id) {
	$con = new ConnectDB();
	$tbl = "loan_for_intro_product";
	$condition = array('keyipro' => $id);
	return $con -> delete($tbl, $condition);
}

?>